Skip to content

crypto: dudect's classes differ in the secret's bytes alone; a hosted runner prints dudect's |t| without judging it - #9

Merged
pinhopro merged 1 commit into
mainfrom
fix/ct-ci
Nov 20, 2026
Merged

pinhopro merged 1 commit into
mainfrom
fix/ct-ci

Conversation

@pinhopro

Copy link
Copy Markdown
Contributor

Fixes the dudect_bearssl failure of main's final CI (run 44690336353, job "Own lane (crypto, constant-time, native)": equal 21.31, chacha seal 10.68).

Cause

The cause was the harness, not the code.

  • clang 18's x86-64 code of equal (straight-line loads, XOR, OR, no branch) and of BearSSL's SSE2 ChaCha20 with ctmulq Poly1305 (branches on the length and the public encrypt flag only, the final reduction through sete/cmov) has no branch or index on a secret. memcheck and MemorySanitizer passed on the same build.
  • choose copied class 0's input from the fixed array, and class 1's from bytes it had just drawn, which were still in the store buffer. The measured call then took on that difference, whatever it computed.
  • Diagnostic runs on GitHub's ubuntu-24.04 runners (2026-11-20, a temporary branch, now deleted) checked this on four processors, idle and with every processor busy:
    • With the old copy:
      • equal read |t| 31 to 56 on an Intel Xeon 6975P-C, with every equal variant affected alike: equal or unequal inputs, zero or 0x5a.
      • The webcpp seal read 28 to 85 on AMD EPYC 9V45 and 9V74, while BearSSL's own seal on the same keys read about 1.
      • A measured call that does nothing read up to 117 when every processor was busy.
    • With a blend that reads both sources and writes the secret with the same instructions for either class: 23 runs of 24 stayed below 4.4 on the Xeon, an EPYC 9V74 and an EPYC 7763, idle and busy.

Ruling

  • choose now blends through a mask read from a volatile. It is branchless on x86-64, and its instructions are the same for either class.
  • The 24th run read 69.8, on both seeds, on a case that read below 4.4 everywhere else. A hosted runner is a shared virtual machine whose processor changes from run to run, so a verdict there would pass or fail with the machine drawn.
  • When RUNNER_ENVIRONMENT is github-hosted, the Jamfile defines WEBCPP_TEST_DUDECT_UNJUDGED. dudect_bearssl, dudect_sodium and dudect_secp256k1 then print their |t| and pass.
  • memcheck, MemorySanitizer and dudect_planted stay judged on hosted runners. dudect is judged on any other machine.
  • The ruling is written in dudect.hpp (choose, judged), in doc/backends.adoc, in doc/testing.adoc, and in crypto.json's checker name, which the generated tables carry.

Verification

  • The native dudect programs on macOS arm64 under DIT all pass, and dudect_planted still finds its leak (|t| 44). They were also run with RUNNER_ENVIRONMENT=github-hosted, which prints "printed, not judged".
  • The wasip2 lane constant-time passes.
  • generate.py and generate_test.py pass.
  • clang-format is clean.
  • The full macOS lint is clean, apart from untracked local files.
  • clang-tidy on Linux x86-64 (the webcpp-lint-linux image) is clean on the four dudect programs, with and without the define.

🤖 Generated with Claude Code

…nner GitHub hosts prints dudect's |t| without judging it

The CI's x86-64 runs of the lane constant-time failed dudect_bearssl: equal at |t| 21 to 25 and
once ChaCha20-Poly1305's seal at 10.7. clang 18's x86-64 code of equal and of BearSSL's SSE2
ChaCha20 and ctmulq Poly1305 has no branch or index on a secret, and memcheck passed on it. The
cause was the harness: choose copied class 0's input from the fixed array and class 1's from bytes
just drawn, still in the store buffer, and the measured call inherited that difference whatever it
computed. Measured on GitHub's runners (2026-11-20): equal at |t| 31 to 56 on an Intel Xeon
6975P-C and the seal at 28 to 85 on AMD EPYC 9V45 and 9V74 with that copy; through a blend that
reads both sources and writes the secret with the same instructions for either class, 23 runs of
24 below 4.4 on the Xeon, an EPYC 9V74 and an EPYC 7763, idle and with every processor busy.

The 24th read 69.8 on a case below 4.4 everywhere else: a hosted runner is a shared virtual
machine whose processor changes from run to run, and a verdict there would pass or fail with the
machine drawn. There the Jamfile defines WEBCPP_TEST_DUDECT_UNJUDGED (RUNNER_ENVIRONMENT is
github-hosted), and dudect_bearssl, dudect_sodium and dudect_secp256k1 print their |t| and pass;
memcheck, MemorySanitizer and dudect_planted stay judged, and dudect is judged on any other
machine. The constant-time section and the page's checker name say so.
@pinhopro
pinhopro merged commit 171a596 into main Nov 20, 2026
3 of 36 checks passed
@pinhopro
pinhopro deleted the fix/ct-ci branch November 20, 2026 10:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant